//package com.fled.itsmbigscreen.config;
//
//import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
//import com.qike.sky_purchase.redis.RedisKeySerializer;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.data.redis.listener.RedisMessageListenerContainer;
//
//@Configuration
//public class RedisConfig {
//
//    @Bean(name = "redisTemplate")
//    public RedisTemplate<String, Object> getRedisTemplate(RedisConnectionFactory factory) {
//
//        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
//        redisTemplate.setConnectionFactory(factory);
//        //StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
//        RedisKeySerializer redisKeySerializer = new RedisKeySerializer();
//        redisTemplate.setKeySerializer(redisKeySerializer); // key的序列化类型
//        redisTemplate.setHashKeySerializer(redisKeySerializer);
//
//        GenericFastJsonRedisSerializer genericFastJsonRedisSerializer = new GenericFastJsonRedisSerializer();
//        redisTemplate.setValueSerializer(genericFastJsonRedisSerializer); // value的序列化类型
//        redisTemplate.setHashValueSerializer(genericFastJsonRedisSerializer);
//        redisTemplate.afterPropertiesSet();
//        return redisTemplate;
//    }
//
//    @Bean
//    public RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {
//        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
//        container.setConnectionFactory(connectionFactory);
//        return container;
//    }
//
//
//}
//
